/*
 * Copyright (c) 2018-2023 北京华恒盛世科技有限公司
 * QUICKPOOL is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *     http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
*/

#ifndef RESOURCE_LIMIT_H
#define RESOURCE_LIMIT_H

#include <unistd.h>
#include <sys/resource.h>

#define DEFAULT_RESOURCE_LIMIT -1
#define RESOURCE_LIMIT_CPU      0
#define RESOURCE_LIMIT_FSIZE    1
#define RESOURCE_LIMIT_DATA     2
#define RESOURCE_LIMIT_STACK    3
#define RESOURCE_LIMIT_CORE     4
#define RESOURCE_LIMIT_RSS      5
#define RESOURCE_LIMIT_NOFILE   6
#define RESOURCE_LIMIT_OPEN_MAX 7
#define RESOURCE_LIMIT_VMEM     8
#define RESOURCE_LIMIT_SWAP     RESOURCE_LIMIT_VMEM
#define RESOURCE_LIMIT_RUN      9
#define RESOURCE_LIMIT_PROCESS  10

#define RESOURCE_LIMIT_NUM  11

struct resourceLimit {
    unsigned int rlim_curl;
    unsigned int rlim_curh;
    unsigned int rlim_maxl;
    unsigned int rlim_maxh;
};

#endif
